﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace GRTVPluginConsole.Webserver
{
    public class HttpParameters
    {
        private Dictionary<string, string> httpParams;
        public HttpParameters(Dictionary<string, string> httpParams)
        {
            this.httpParams = httpParams;
        }

        public string GetString(string key, string defaultValue) {
            if (httpParams.ContainsKey(key))
            {
                return httpParams[key];
            }
            else
            {
                return defaultValue;
            }
        }
        public int GetInt(string key, int defaultValue) {
            if (httpParams.ContainsKey(key))
            {
                int number = defaultValue;
                Int32.TryParse(httpParams[key], out number);
                return number;
            }
            else
            {
                return defaultValue;
            }
        }

    }
}
